import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import TypeNav from './components/TypeNav'
import Pagination from './components/Pagination'
import './plugins/lazyload'  //图片懒加载模块
import './plugins/elements' //element-ui模块
import SwiperLoop from '@/components/SwiperLoop' //封装的轮播图组件



import  './mock/mockServer'

import "swiper/css/swiper.min.css"; //因为下面还有轮播图，所以最好是放在main.js中


import * as API from './api/index'  //引入所有ajax暴露的接口


Vue.config.productionTip = false

//全局注册TypeNav，因为很多组件用到了TypeNav
 Vue.component(TypeNav.name,TypeNav)   //三级导航
 Vue.component(Pagination.name,Pagination)  //分页器
 Vue.component('SwiperLoop',SwiperLoop)  //轮播图组件


new Vue({
  router, //注入router 让所有的组件对象都能通过this.$router和this.$route找到路由器对象和当前的路由对象
  store,
  render: h => h(App),
  beforeCreate(){
     Vue.prototype.$bus = this //注册全局事件总线
     Vue.prototype.$API = API  //
  }
}).$mount('#app')
